<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>{$meta_title} [
            <present name="Think.get.group">
                <a href="{:U('index')}">全部</a>
                <else/>
                <strong>全部</strong></present>
            &nbsp;
            <foreach name="group" item="vo">
                <neq name="group_id" value="$key">
                    <a href="{:U('index?group='.$key)}">{$vo}</a>
                    <else/>
                    <strong>{$vo}</strong></neq>
                &nbsp;
            </foreach>
            ]
        </h2>
    </div>

    <div class="cf">
        <a class="btn" href="{:U('add')}">新 增</a>
        <button class="btn ajax-post confirm" url="{:U('del')}" target-form="ids">删 除</button>
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入幻灯片名称">
                <a class="sch-btn" href="javascript:;" id="search" url="__SELF__"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>

    <div class="data-table table-striped">
        <table>
            <thead>
            <tr>
                <th class="row-selected">
                    <input class="checkbox check-all" type="checkbox">
                </th>
                <th>ID</th>
                <th>名称</th>
                <th>链接</th>
                <th>图片</th>
                <th>状态</th>
                <th>时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="list">
                <volist name="list" id="tuba">
                    <tr>
                        <td><input class="ids row-selected" type="checkbox" name="id[]" value="{$tuba.id}"></td>
                        <td>{$tuba.id}</td>
                        <td><a title="" href="{:U('edit?id='.$tuba['id'].'&mark='.$tuba['mark'])}">{$tuba.title}</a></td>
                        <td>{$tuba.url}</td>
                        <td><img src="__ROOT__/Uploads{$tuba['url']}" width="100" height="50"/>（670*400）
                            <a title="" href="__ROOT__/Uploads{$tuba['url']}" target='_blank'>查看大图</a>
                        </td>
                        <td>
                            <eq name="tuba.status" value="1">已展示<else/>未展示</eq>
                        </td>
                        <td>{$tuba.create_time|date='Y-m-d H:i:s',###}</td>
                        <td>
                            <a title="" href="{:U('edit?id='.$tuba['id'])}">编辑</a>
                            <a class="ajax-get" href="{:U('active?id='.$tuba['id'].'&status=1')}">启用</a>
                            <a class="ajax-get" href="{:U('active?id='.$tuba['id'].'&status=0')}">禁用</a>
                            <a class="confirm ajax-get" title="删除" href="{:U('del?id='.$tuba['id'])}">删除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="6" class="text-center"> aOh! 暂时还没有内容!</td>
            </notempty>
            </tbody>
        </table>

        <!-- 分页 -->
        <div class="page">
            {$_page}
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function () {
            //搜索功能
            $("#search").click(function () {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });
            //回车搜索
            $(".search-input").keyup(function (e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
        });
    </script>
</block>